home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / FANGS__ / GRAPHIC.C < prev    next >
Text File  |  1990-05-28  |  1KB  |  98 lines

  1. /* ⌐ 1990 Patrick Doane. */
  2.  
  3. #include <Graphic.h>
  4.  
  5. extern RgnHandle    theRgn;
  6.  
  7. void    Graphic::IGraphic(WindowPtr theWindow,Rect *theBounds)
  8. {
  9.     Object::IObject();
  10.     bounds = *theBounds;
  11.     extent = *theBounds;
  12.     
  13.     itsWindow = theWindow;
  14.     
  15.     nextGraphic = 0L;
  16.     clickOK = false;
  17.     active = true;
  18.     activate = true;
  19.     visible = true;
  20.     
  21.     hScale = vScale = 1;
  22.     position.h = 0;
  23.     position.v = 0;
  24. }
  25.  
  26. void    Graphic::Dispose(void)
  27. {
  28.     inherited::Dispose();
  29. }
  30.  
  31. void    Graphic::SetBounds(Rect *theBounds)
  32. {
  33.     bounds = *theBounds;
  34. }
  35.  
  36. void    Graphic::GetBounds(Rect *theBounds)
  37. {
  38.     *theBounds = bounds;
  39. }
  40.  
  41. void    Graphic::Show(void)
  42. {
  43.     visible = true;
  44. }
  45.  
  46. void    Graphic::Hide(void)
  47. {
  48.     visible = false;
  49. }
  50.  
  51. void    Graphic::Activate(void)
  52. {
  53.     if (!active)
  54.         active = true;
  55. }
  56.  
  57. void    Graphic::Deactivate(void)
  58. {
  59.     if (active)
  60.         active = false;
  61. }
  62.  
  63. void    Graphic::Update(void)
  64. {
  65. }
  66.  
  67. void    Graphic::DoClick(EventRecord *theEvent)
  68. {
  69. }
  70.  
  71. void    Graphic::Idle(void)
  72. {
  73. }
  74.  
  75. void    Graphic::Scroll(short hDelta,short vDelta,Boolean redraw)
  76. {
  77.     short        hPixels;
  78.     short        vPixels;
  79.     Rect        theRect;
  80.     
  81.     hPixels = hDelta * hScale;
  82.     vPixels = vDelta * vScale;
  83.     
  84.     if (redraw)
  85.     {    theRect = bounds;
  86.         ScrollRect(&theRect,-hPixels,-vPixels,theRgn);
  87.         InvalRgn(theRgn);
  88.     }
  89.  
  90.     position.h += hDelta;
  91.     position.v += vDelta;
  92.  
  93.     if (redraw)
  94.     {    BeginUpdate(thePort);
  95.         Update();
  96.         EndUpdate(thePort);
  97.     }
  98. }